﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace ObservableCollectionProject
{
    public class NameValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            if (value != null && value.ToString().Length > 1 && value.ToString().Length <= 10)
            {
                return new ValidationResult(true, "通过");
            }
            return new ValidationResult(false, "请输入1-10字符内的名字");
        }
    }
}
